const namespace = 'todolist_'

const local = {
    set(key, data) {
        localStorage.setItem(namespace + key, JSON.stringify(data))
    },
    get(key) {
        const data = localStorage.getItem(namespace + key)
        return JSON.parse(data)
    }
}
const session = {
    set(key, data) {
        sessionStorage.setItem(namespace + key, JSON.stringify(data))
    },
    get(key) {
        const data = sessionStorage.getItem(namespace + key) ||'[]'
        return JSON.parse(data)
    }
}

export {
    local,
    session
}